<template>
  <div>
    <up-down-layout :header="'体系文件查询'" :handleFlag="true" >
      <template slot="query">
        <search-form :componentList="componentList" :formValue="queryParas" @handleFilter="handleFilter"
          @clearParam="clearParam">
        </search-form>
      </template>
      <template slot="table">
        <!-- table表格 -->
        <data-table :toolMenuFlag="false" @onCreateRow="addData" :sourceData="sourceData" :queryParas="queryParas"
          @onEditRow="onEditRow" :menuFlag="false" :IsRight="false" :operateBtnLayout="operateBtnLayout"
          :columns="columns" :deleteApi="api" :api="api" :loadCount="loadCount" :operatWidth="'90px'"
          :loadPage="'getPagePermisson'"
          >
          <template scope-slot="button" v-slot:button="row" >
            <el-button icon="el-icon-document"  class="iconCircle" title="文件查看" @click="fileManager(row)"></el-button>
          </template>
        </data-table>
      </template>
    </up-down-layout>
    <!-- 体系新增弹窗 -->
    <systemEdit :editModel="editModel" :visible.sync="dialogVisible" :api="api" :form="item" @handSearch="handleFilter"/>
    <!-- 文件夹管理 -->
    <el-drawer
      title=""
      :visible.sync="drawer"
      size="80%" class="file-drawer"
      direction='btt'
      :with-header="true">
      <!-- 文件目录-->
      <fileSystem :authOpt="'V'" :bizId ="bizId" :bizType="bizType" class="file-content" :bizTypeName = "bizTypeName"></fileSystem>
    </el-drawer>
  </div>
</template>
<script>
import BaseManage from '@/pages/baseManage'
import upDownLayout from '@/components/element/upDownLayout'
import searchForm from '@/components/element/searchForm'
import DataTable from '@/components/element/DataTable'
// import businessApi from '@/api/business/businessApi'
import systemEdit from '@/pages/fileManage/systemEdit'
import fileSystem from '@/pages/fileManage/fileSystem/fileSystem'
import privilegeManage from '@/pages/fileManage/privilegeManage'
import { fileManageApi } from '@/api/business/businessApi'
export default {
  // 继承baseManage里的公共方法和定义的属性
  extends: new BaseManage(),
  name: 'fileList',
  components: {
    upDownLayout,
    searchForm,
    DataTable,
    systemEdit,
    fileSystem,
    privilegeManage
  },
  data () {
    return {
      drawer: false,
      bizId: '',
      bizType: '',
      bizTypeName: '',
      dialogVisiblePrivilger: false,
      componentList: [
        {
          prop: 'docName',
          componentName: 'el-input',
          label: '体系名称',
          value: 'docName',
          placeholder: '请输入体系名称'
        },
        {
          prop: 'docCode',
          label: '体系编码',
          componentName: 'el-input',
          // api: businessApi.getAllDepartment, // 将api传送给组件自动获取数据
          value: 'docCode',
          placeholder: '请输入体系编码'
        },
        {
          prop: 'oweOrgName',
          label: '所属单位',
          componentName: 'el-input',
          // api: businessApi.getAllDepartment, // 将api传送给组件自动获取数据
          value: 'oweOrgName',
          placeholder: '请输入所属单位'
        }
      ],
      queryParas: {
        createTime: '',
        oweOrgName: '',
        useOrgId: ''
      },
      // talbe显示的每一项
      columns: [
        {
          prop: 'docCode',
          label: '体系编码',
          align: 'left',
          width: '150px'
        },
        {
          prop: 'docName',
          label: '体系名称',
          align: 'left'
        },
        {
          prop: 'oweOrgName',
          label: '所属单位',
          align: 'left',
          width: '200px'
        }
        // {
        //   prop: 'openTarget',
        //   label: '公开对象',
        //   align: 'center'
        // }
      ],
      // 操作列需要显示的按钮
      operateBtnLayout: 'V'
    }
  },
  computed: {
    api () {
      return fileManageApi
    }
  },
  created () {
  },
  methods: {
    // 提交
    submit (data) {
      // console.log('submit', data)
    },
    // 文件管理  bizType 体系1 政策2 课提3
    fileManager (row) {
      this.bizType = '1'
      this.bizId = row.row.id
      this.bizTypeName = row.row.docName
      this.drawer = true
    }
  }
}
</script>
<style lang="scss" scope>
  .file-drawer .el-drawer__header {
    margin-bottom: 10px;
    background: rgb(248, 248, 248);
  }
  .file-content {
    margin: 0 20px 0 15px;
  }
</style>
